package cn.wp.ewallet.wallet.web.controller;

import cn.wp.common.core.Wp;
import cn.wp.common.core.dto.WpResult;
import cn.wp.common.core.model.WpPage;
import cn.wp.common.core.web.annotation.ClearInterceptor;
import cn.wp.common.core.web.interceptor.LoginInterceptor;
import cn.wp.ewallet.wallet.model.dto.MentionMoneyInfoDto;
import cn.wp.ewallet.wallet.model.dto.ReqOrderInfoDto;
import cn.wp.ewallet.wallet.service.ReqOrderInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 申请单-控制层
 * Created by zhangyongli on 2020/01/09
 */
@RestController
@RequestMapping(Wp.WebContext + "/ewallet/wallet/reqOrder")
@Api(tags="申请单")
public class ReqOrderInfoController {

    @Autowired
    private ReqOrderInfoService reqOrderInfoService;

    @GetMapping("/all")
    @ApiOperation(value = "查询全部申请单")
    public WpResult getAllReqOrder(WpPage page) {
        return new WpResult().success(reqOrderInfoService.getAllReqOrder(page));
    }

    @GetMapping("/pending")
    @ApiOperation(value = "查询待处理申请单")
    public WpResult getPendingReqOrder(WpPage page) {
        return new WpResult().success(reqOrderInfoService.getPendingReqOrder(page));
    }

    @GetMapping("/id/exchangeMoney")
    @ApiOperation(value = "查询单个兑换申请单")
    public WpResult getExchangeMoneyReqOrderById(String orderId) {
        return new WpResult().success(reqOrderInfoService.getExchangeMoneyReqOrderById(orderId));
    }

    @GetMapping("/id/mentionMoney")
    @ApiOperation(value = "查询单个提币申请单")
    public WpResult getMentionMoneyReqOrderById(String orderId) {
        MentionMoneyInfoDto mentionMoneyInfoDto = reqOrderInfoService.getMentionMoneyReqOrderById(orderId);
        return new WpResult().success(mentionMoneyInfoDto);
    }

    @GetMapping("/address/exchangeMoney")
    @ApiOperation(value = "查询兑换记录")
    public WpResult getExchangeMoneyReqOrderByaddress(WpPage page) {
        return new WpResult().success(reqOrderInfoService.getExchangeMoneyReqOrderByaddress(page));
    }

    @GetMapping("/address/mentionMoney")
    @ApiOperation(value = "查询提币记录")
    public WpResult getMentionMoneyReqOrderByAddress(WpPage page) {
        return new WpResult().success(reqOrderInfoService.getMentionMoneyReqOrderByAddress(page));
    }

    @GetMapping("/moneyType/mentionMoney")
    @ApiOperation(value = "按币种类型查询提币记录")
    public WpResult getMentionMoneyReqOrderByMoneyType(String startTime,String endTime,String moneyType, WpPage page) {
        return new WpResult().success(reqOrderInfoService.getMentionMoneyReqOrderByMoneyType(startTime, endTime, moneyType, page));
    }

    @GetMapping("/getReqOrderInfoDtosByParams")
    @ApiOperation(value = "查询申请单 全部查询 部分条件查询")
    public WpResult getReqOrderInfoDtosByParams(String startTime,String endTime,String reqType,WpPage wpPage){
        return new WpResult().success(reqOrderInfoService.getReqOrderInfoDtosByParams(startTime, endTime, reqType, wpPage));
    }
}